#ifndef CVUSERMANAGER_H
#define CVUSERMANAGER_H

#include <QObject>
#include <QByteArray>
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptValue>
#include <QUrl>
#include <QtNetwork/QNetworkReply>
#include <QStringList>

#include "util/cvutil.h"
#include "http/cvhttp.h"
#include "model/cvuser.h"

class CVUserManager : public QObject
{
    Q_OBJECT
public:
    explicit CVUserManager();
    
    void validating(const QString &username, const QString &password, const QString &network);
    void getLoggedUser();

signals:
    void validated(bool result, const QString &msg, QNetworkReply::NetworkError error);
    void handleUser(CVUser *user, const QString &msg);
public slots:
private slots:
    void handValidate(QScriptValue value, const QString &msg);
    void handError(QNetworkReply::NetworkError error);
    void parseUserData(QScriptValue json, const QString &msg);
private:

};

#endif // CVUSERMANAGER_H
